<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023-04-07
  Time: 11:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
  <title>学生选课系统</title>
</head>
<body>
<h1>学生选课列表</h1>
<hr>
<table border="1">
  <tr>
    <th>课程ID</th>
    <th>课程</th>
    <th>学生</th>
  </tr>
  <c:forEach var="course" items="${sessionScope.courses}">
    <tr>
      <td>${course.id}</td>
      <td>${course.title}</td>
      <c:if test="${course.students.size() eq 0}">
        <td>
         没有学生选择此课程
        </td>
      </c:if>
      <c:if test="${course.students.size() ne 0}">
        <td>
          <c:forEach var="student" items="${course.students}">
            ${student.name}
            <br>
          </c:forEach>
        </td>
      </c:if>
    </tr>
  </c:forEach>
</table>
</body>
</html>
